package com.blkbox.javase.annotation.ex1;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class MyReflect {
	public static void main(String[] args) throws Exception {
		Class<AnnotationUsage> annotationUsageC = AnnotationUsage.class;

		Method method = annotationUsageC.getMethod("out");

		if (method.isAnnotationPresent(MyAnnotation.class)) {
			MyAnnotation myAnnotation =

			method.getAnnotation(MyAnnotation.class);
			String value = myAnnotation.value();
			String[] array = myAnnotation.array();

			System.out.println(value);
			System.out.println(array);
		}

		Annotation[] annotations = method.getAnnotations();
		for (Annotation annotation : annotations) {
			System.out.println(annotation.annotationType());
		}
	}
}